SHELL = /bin/bash

proto:
	protoc -Iapi -I${GOPATH}/src -I${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
		-I ${GOPATH}/src/github.com/envoyproxy/protoc-gen-validate \
		-I ${GOPATH}/src/github.com/golang/protobuf/protoc-gen-go \
		-I ${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway \
		--go_out=plugins=grpc:api \
		--validate_out=lang=go:api \
		--grpc-gateway_out=logtostderr=true:api \
		--swagger_out=logtostderr=true:api \
		api/*.proto;

swg:
	@cp api/*.swagger.json swagger/proto/
	@go-bindata -pkg static -o static/datafile.go swagger/...

vet:
	go vet ./...

build: vet
	@CGO_ENABLED=0 go build -ldflags="-s -w" -o build/server .

run:
	./build/server